var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function () {
        var t = function (e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (t, e) {
                        t.__proto__ = e;
                    }) ||
                function (t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function (e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })();
Object.defineProperty(o, "__esModule", {value: !0});
var r = t("OnCollision"),
    a = t("ConfS"),
    i = t("body"),
    s = t("build"),
    c = t("fightManager"),
    l = (function (t) {
        function e() {
            var e = (null !== t && t.apply(this, arguments)) || this;
            return (e.boxs = []), e;
        }
        return (
            n(e, t),
            (e.prototype.onEnter = function () {
                (this.array = this.context.node.addComponent(r.default).array),
                    (this.distance = this.context.data.distance);
            }),
            (e.prototype.onUpdate = function (t) {
                for (var e = 0; e < this.array.length; e++) {
                    var o = this.array[e],
                        n = void 0;
                    if (
                        ((n = 1 == o.tag ? o.getComponent(s.default) : o.getComponent(i.default)),
                        !this.boxs.includes(n))
                    ) {
                        this.boxs.push(n);
                        for (var r = this.context.data.damageBoxs, l = 0; l < r.length; l++) {
                            var u = r[l],
                                p = a.DatasManager.NearDatasById[u];
                            c.default.inst.bombBox.add(
                                this.context.body,
                                this.context.skill,
                                p,
                                this.context.index,
                                this.context,
                                n
                            );
                        }
                        if (this.context.isDestory()) return void this.context.node.destroy();
                    }
                }
                (this.distance -= t * this.context.data.speed * c.default.inst.speed.value),
                    this.distance <= 0 && this.context.node.destroy();
            }),
            e
        );
    })(t("flyBoxState").default);
o.default = l;
